package com.lonely.common.enums;


import com.lonely.common.core.domain.api.IResultCode;

/**
 * 返回结果通用枚举
 *
 * @author
 */
public enum ResultCodeEnum implements IResultCode {

    SUCCESS(0, "操作成功"),
    FAILURE(10002, "业务异常"),
    UN_AUTHORIZED(403, "请求未授权"),
    TOKEN_INVALID(403, "登录已过期"),
    CLIENT_UN_AUTHORIZED(403, "客户端请求未授权"),
    NOT_FOUND(404, "404 没找到请求"),
    MSG_NOT_READABLE(400, "消息不能读取"),
    METHOD_NOT_SUPPORTED(405, "不支持当前请求方法"),
    MEDIA_TYPE_NOT_SUPPORTED(415, "不支持当前媒体类型"),
    REQ_REJECT(403, "请求被拒绝"),
    INTERNAL_SERVER_ERROR(10001, "服务器异常"),
    PARAM_MISS(10003, "缺少必要的请求参数"),
    PARAM_TYPE_ERROR(10004, "请求参数类型错误"),
    PARAM_BIND_ERROR(10004, "请求参数绑定错误"),
    PARAM_VALID_ERROR(10005, "参数校验失败"),

    ENUM_KEY_NOT_EXISTS(10006, "[${}]:[${}]对应枚举不存在,请修改"),

    MODEL_RULE_EXPRESS_EXEC_EXCEPTION(10007, "表达式执行错误：[${}]"),

    APP_COPY_INSERT_DATA_ERROR(10008, "应用复制插入数据时错误"),
    APP_COPY_ROLLBACK_DATA_ERROR(10009, "应用复制回滚数据时错误");

    final int code;
    final String message;

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    ResultCodeEnum(final int code, final String message) {
        this.code = code;
        this.message = message;
    }
}
